home *** CD-ROM | disk | FTP | other *** search
/ Network Support Library / RoseWare - Network Support Library.iso / apidev / tpapi.exe / EXAMPLES / CHANPASS.PAS < prev    next >
Pascal/Delphi Source File  |  1994-01-14  |  3KB  |  107 lines

  1. {***************************************************************************}
  2. {** Program : CHANPASS                                                    **}
  3. {***************************************************************************}
  4. {** Version : 1.0             ** Started :           ** Ended :           **}
  5. {***************************************************************************}
  6. {******************************** Description ******************************}
  7. {***************************************************************************}
  8. {** Program to change a users password.                                   **}
  9. {**                                                                       **}
  10. {**                                                                       **}
  11. {**                                                                       **}
  12. {**                                                                       **}
  13. {**                                                                       **}
  14. {**                                                                       **}
  15. {**                                                                       **}
  16. {***************************************************************************}
  17. {******************************** Information ******************************}
  18. {***************************************************************************}
  19. {**                                                                       **}
  20. {**                                                                       **}
  21. {**                                                                       **}
  22. {**                                                                       **}
  23. {**                                                                       **}
  24. {**                                                                       **}
  25. {***************************************************************************}
  26.  
  27. {$X+}
  28.  
  29. program CHANPASS;
  30.  
  31. uses
  32.  
  33.   nwvar,
  34.   nwerror,
  35.   nwbindry,
  36.   nwmisc
  37.   ;
  38.  
  39. var
  40.  
  41.   BS    : BinderyOBJ;
  42.   MNW   : MiscFuncOBJ;
  43.   OldPW,
  44.   NewPW : TPassword;
  45.  
  46. procedure Initialise;
  47.  
  48. begin
  49.  
  50.   if paramcount < 2 then
  51.     begin
  52.  
  53.       writeln;
  54.       writeln ('USAGE : [oldpassword] [newpassword]');
  55.       writeln;
  56.       halt;
  57.  
  58.     end;
  59.  
  60.   BS.Init (true);
  61.   MNW.Init (true);
  62.   OldPW := paramstr (1);
  63.   NewPW := paramstr (2);
  64.  
  65. end; {Initialise}
  66.  
  67. {***}
  68.  
  69. procedure Done;
  70.  
  71. begin
  72.  
  73.   BS.Done;
  74.   MNW.Done;
  75.  
  76. end; {Done}
  77.  
  78. {***}
  79.  
  80. procedure ChangePassword;
  81.  
  82. var
  83.  
  84.   ObjectName : TObjectName;
  85.   ObjectType : OT_BinderyType;
  86.   ObjectID   : OT_BinderyID;
  87.  
  88. begin
  89.  
  90.   WITH MNW DO
  91.     GetObjectNameID (GetDefaultFileServerName, ObjectName, ObjectType, ObjectID);
  92.   writeln ('Changing password for user : ', ObjectName);
  93.   write ('Status code : ');
  94.   writeln (GetBinderyServicesError (BS.ChangeBinderyObjectPassword (ObjectName, ObjectType,
  95.            OldPW, NewPW)));
  96.  
  97. end; {ChangePassword}
  98.  
  99. {***}
  100.  
  101. begin
  102.  
  103.   Initialise;
  104.   ChangePassword;
  105.   Done;
  106.  
  107. end.